package week2;
import java.util.*;
public class Day3 {

    //1.添加逗号
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            long N = in.nextInt();
            StringBuilder sb = new StringBuilder();
            int k=0;
            while(N!=0) {
                int ch = (int)N%10 ;
                sb.append((char)(ch+'0'));
                k++;
                N/=10;
                if(k%3==0 && N > 0) {
                    sb.append(',');
                }
            }
            System.out.println(sb.reverse().toString());
        }
    }
    //2.跳台阶
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int[] dp = new int[n];
            if(n>=1)
                dp[n-1]=1;
            if(n>=2)
                dp[n-2]=2;
            for(int i=n-3;i>=0;i--) {
                dp[i]=dp[i+1]+dp[i+2];
            }
            System.out.println(dp[0]);
        }
    }
    //3.扑克牌顺子
    public boolean IsContinuous (int[] numbers) {
        // write code here
        Arrays.sort(numbers);
        int tmp=0;//记录0的个数
        int left=0;
        for(;left<5;left++) {
            if(numbers[left]==0)
                tmp++;
            else
                break;
        }
        if(tmp==4) return true;
        int right=left+1;
        while(right<5) {
            if(! (numbers[right]-numbers[left]==1||numbers[left]-numbers[right]==12)) {
                //消耗0的情况
                int s = numbers[left] - numbers[right];
                if(s == 0) {
                    return false;
                }else if(s < 0) {
                    s=s*(-1) - 1;//消耗0的个数
                    tmp-=s;
                    if(tmp<0) return false;
                }else {
                    tmp-=(numbers[right]-1);
                    if(tmp<0) return false;
                }
            }
            left++;
            right++;
        }
        return true;
    }


}
